let arr = [6,5,4]
arrNew = arr.filter((value,index) => value % 2 == 0)
console.log(arrNew)

let arr1 = [2, 8, 3, 4, 1, 3, 2, 9]

const obj = () => {this.MAX =3}

const myFilter = (item) => {
    if (item > this.MAX) {
        return true
    }
}

let arr2 = arr1.filter(myFilter, obj())
console.log(arr2)
let flag = false
let arr3 = [1, 2, 3, 4, 5];
flag =arr3.some(elem => elem >= 3)
console.log(flag)
flag =arr3.every(elem => elem >= 3)
console.log(flag)
console.log("-------------------------")

let arr4 = [1, 2, 3, 4]
Array.prototype.sum = function () {
    return this.reduce((prev, cur) => prev + cur)
}
console.log(arr4.sum())

Array.prototype.sum2 = function () {
    return this.reduce((prev, cur) => {return prev + cur}, 10)
}
console.log(arr4.sum2())
console.log("-------------------------")

let array1 = ['a','b','c','d']
let num = array1.indexOf('d')
console.log(num)
